package com.xzit.rcpyxt.exceptions;

import com.xzit.rcpyxt.constant.MessageCode;

public class CustomeException extends RuntimeException {

    private static final long serialVersionUID = 1L;

    /**
     * 返回码
     */
    private int code;

    /**
     * 返回结果描述
     */
    private String message;

    /**
     * 返回内容
     */
    private Object data;

    public int getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public Object getData() {
        return data;
    }

    public CustomeException(int code, String message) {
        this.code = code;
        this.message = message;
        this.data = "";
    }

    public CustomeException(int code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public CustomeException(MessageCode msgcode) {
        this.code = msgcode.getCode();
        this.message = msgcode.getMessage();
        this.data = "";
    }

    public CustomeException(MessageCode msgcode, Object data) {
        this.code = msgcode.getCode();
        this.message = msgcode.getMessage();
        this.data = data;
    }

}